#include "game.h"
#include "ui_game.h"
#include <QRandomGenerator>

game::game(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::game)
{
    ui->setupUi(this);
    this->setGeometry(QRect(600,300,780,600));//设定窗体大小和起始坐标

}

void game::paintEvent(QPaintEvent *event){
    QPainter painter(this);//画游戏背景
    painter.setPen(Qt::black);
    painter.setBrush(Qt::yellow);
    painter.drawRect(15,15,560,560);//外围
    painter.setPen(Qt::black);
    painter.setBrush(Qt::green);
    painter.drawRect(25,25,540,540);
    QPixmap imgCursor(":/Images/Img/hit.png");
    QCursor cursor(imgCursor);
    setCursor(cursor);
    painter.drawPixmap(25,25,540,540,QPixmap(":/Images/Img/grass.png"));
    //painter.setPen(Qt::black);
    /*for(int i=1;i<4;i++){
        painter.drawLine(35,i*180,560,i*180);
        painter.drawLine(i*180,35,i*180,560);
    }*/


}


game::~game()
{
    delete ui;
}




void game::on_toolButton_clicked()
{
    nScore+=10;
}




